import globals from "globals";
import pluginJs from "@eslint/js";
import tseslint from "typescript-eslint";
import pluginReact from "eslint-plugin-react";

/** @type {import('eslint').Linter.Config[]} */
export default [
  {
    files: ["**/*.{js,mjs,cjs,ts,jsx,tsx}"],
    extends: [
      pluginJs.configs.recommended,
      ...tseslint.configs.recommended,
      pluginReact.configs.flat.recommended,
      // 引入 prettier 作为规则
      "plugin:prettier/recommended",
    ],
  },

  { languageOptions: { globals: { ...globals.browser, ...globals.node } } },
  {
    rules: {
      "no-console": "off",
      // 禁止多行空格，允许最多一个空行
      "no-multiple-empty-lines": ["error", { max: 1 }],
      // 强制使用单引号
      quotes: ["error", "double"],
    },
  },
];
